import React, { lazy } from "react";
import { MailOutlined } from "@ant-design/icons";

// 声明类型
export interface SyncRoute {
  path: string;
  component: React.LazyExoticComponent<React.FC>;
  children?: Array<SyncRoute>;
  meta?: {
    needLogin?: boolean;
    isMenu?: boolean;
    title?: string;
    icon?: React.ReactNode;
  };
}

const RouteTable: Array<SyncRoute> = [
  {
    path: "/", //
    component: lazy(() => import("../pages/home")),
  },
  {
    path: "/form", //一级路由
    component: lazy(() => import("../pages/home")),
    meta: {
      title: "问卷设计",
      isMenu: true,
      needLogin: true,
    },
    children: [
      // {
      //   path: "/form/thyroid_form", //一级路由
      //   component: lazy(() => import("../pages/thyroid_nodule_form")),
      //   meta: {
      //     title: "ThyroidForm",
      //     isMenu: true,
      //     needLogin: true,
      //   },
      // },
      // {
      //   path: "/form/thyroid_detail", //一级路由
      //   component: lazy(() => import("../pages/thyroid_nodule_detail")),
      //   meta: {
      //     title: "ThyroidDetail",
      //     isMenu: true,
      //     needLogin: true,
      //   },
      // },
      // {
      //   path: "/form/designable_basic", //一级路由
      //   component: lazy(() => import("../pages/designable_basic")),
      //   meta: {
      //     title: "DesignableBasic",
      //     isMenu: true,
      //     needLogin: true,
      //   },
      // },
      // {
      //   path: "/form/formily-designer", //一级路由
      //   component: lazy(() => import("../pages/formily_designer")),
      //   meta: {
      //     title: "FormilyDesigner",
      //     isMenu: true,
      //     needLogin: true,
      //   },
      // },
      // {
      //   path: "/form/formily", //一级路由
      //   component: lazy(() => import("../pages/formily")),
      //   meta: {
      //     title: "Formily",
      //     isMenu: true,
      //     needLogin: true,
      //   },
      // },
      {
        path: "/form/formily-shadcn", //一级路由
        component: lazy(() => import("../pages/formily_shadcn")),
        meta: {
          title: "FormilyShadcn",
          isMenu: true,
          needLogin: true,
        },
      },
      {
        path: "/form/formily-antd-v5-cascader", //一级路由
        component: lazy(() => import("../pages/formily_antd_v5_cascader")),
        meta: {
          title: "FormilyAntdV5Cascader",
          isMenu: true,
          needLogin: true,
        },
      },
      {
        path: "/form/formily-antd-v5-table", //一级路由
        component: lazy(() => import("../pages/formily_antd_v5_arrayTable")),
        meta: {
          title: "FormilyAntdV5Table",
          isMenu: true,
          needLogin: true,
        },
      },
      {
        path: "/form/formily-antd-v5", //一级路由
        component: lazy(() => import("../pages/formily_antd_v5")),
        meta: {
          title: "FormilyAntdV5",
          isMenu: true,
          needLogin: true,
        },
      },
      {
        path: "/form/formily-antd-v5-1", //一级路由
        component: lazy(() => import("../pages/formily_antd_v5_exp1")),
        meta: {
          title: "FormilyAntdV5_1",
          isMenu: true,
          needLogin: true,
        },
      },
      {
        path: "/form/react", //一级路由
        component: lazy(() => import("../pages/formily_react")),
        meta: {
          title: "FormilyReact",
          isMenu: true,
          needLogin: true,
        },
      },
      {
        path: "/form/core", //一级路由
        component: lazy(() => import("../pages/formily_core")),
        meta: {
          title: "ReactiveCore",
          isMenu: true,
          needLogin: true,
        },
      },
      {
        path: "/form/reactive", //一级路由
        component: lazy(() => import("../pages/formily_reactive")),
        meta: {
          title: "Reactive",
          isMenu: true,
          needLogin: true,
        },
      },
      {
        path: "/form/reactive-react", //一级路由
        component: lazy(() => import("../pages/formily_reactive_react")),
        meta: {
          title: "Reactive-react",
          isMenu: true,
          needLogin: true,
        },
      },
      {
        path: "/form/designer", //一级路由
        component: lazy(() => import("../designer-antd-v5/MyDesigner")),
        meta: {
          title: "Designer",
          isMenu: true,
          needLogin: false,
        },
      },
      {
        path: "/form/full_calendar", //一级路由
        component: lazy(() => import("../pages/full_calendar")),
        meta: {
          title: "FullCalendar",
          isMenu: true,
          needLogin: true,
        },
      },
      {
        path: "/form/gantt", //一级路由
        component: lazy(() => import("../pages/gantt")),
        meta: {
          title: "gantt",
          isMenu: true,
          needLogin: true,
        },
      },
      {
        path: "/form/pdf", //一级路由
        component: lazy(() => import("../pages/react_pdf")),
        meta: {
          title: "pdf",
          isMenu: true,
          needLogin: true,
        },
      },
      {
        path: "/form/draft", //一级路由
        component: lazy(() => import("../pages/react_draft")),
        meta: {
          title: "draft",
          isMenu: true,
          needLogin: true,
        },
      },
      {
        path: "/form/docx", //一级路由
        component: lazy(() => import("../pages/react_docx")),
        meta: {
          title: "docx",
          isMenu: true,
          needLogin: true,
        },
      },
      {
        path: "/form/docx-pic", //一级路由
        component: lazy(() => import("../pages/react_docx_pic")),
        meta: {
          title: "docx_pic",
          isMenu: true,
          needLogin: true,
        },
      },
      {
        path: "/form/sheetjs", //一级路由
        component: lazy(() => import("../pages/react_sheetjs")),
        meta: {
          title: "sheetjs",
          isMenu: true,
          needLogin: true,
        },
      },
      {
        path: "/form/markdown", //一级路由
        component: lazy(() => import("../pages/react_markdown")),
        meta: {
          title: "markdown",
          isMenu: true,
          needLogin: true,
        },
      },
    ],
  },
  {
    path: "/medicine", //一级路由
    component: lazy(() => import("../pages/home")),
    meta: {
      title: "药学服务",
      isMenu: true,
      needLogin: true,
    },
    children: [
      {
        path: "/medicine/gpt", //一级路由
        component: lazy(() => import("../pages/chat")),
        meta: {
          title: "药学GPT",
          isMenu: true,
          needLogin: true,
        },
      },
    ],
  },
  {
    path: "/system", //一级路由
    component: lazy(() => import("../pages/home")),
    // component: lazy(() => import("../layout/admin_layout")),
    meta: {
      title: "系统管理",
      isMenu: true,
      needLogin: true,
    },
    children: [
      {
        path: "/system/profile", //
        component: lazy(() => import("../pages/profile")),
        meta: {
          isMenu: false,
          needLogin: true,
        },
      },
      //二级路由
      {
        path: "/system/tenants", //为空则默认显示该路由
        component: lazy(() => import("../pages/tenant_manage")),
        meta: {
          title: "中心管理",
          isMenu: true,
          needLogin: true,
        },
      },
      {
        path: "/system/roles", //为空则默认显示该路由
        component: lazy(() => import("../pages/role_manage")),
        meta: {
          title: "角色管理",
          isMenu: true,
          needLogin: true,
        },
        children: [
          //三级路由
          {
            path: "/system/roles/safte", //为空则默认显示该路由
            component: lazy(() => import("../pages/private1")),
            meta: {
              title: "综合模拟",
              isMenu: true,
              needLogin: true,
            },
          },
        ],
      },
      {
        path: "/system/users", //为空则默认显示该路由
        component: lazy(() => import("../pages/user_manage")),
        meta: {
          title: "用户管理",
          isMenu: true,
          needLogin: false,
        },
      },
    ],
  },
  {
    path: "/menu",
    component: lazy(() => import("../pages/menu")),
    meta: {
      title: "菜单",
      isMenu: true,
      needLogin: false,
      icon: <MailOutlined />,
    },
  },
  {
    path: "/pri2",
    component: lazy(() => import("../pages/private2")),
    meta: {
      title: "首页2",
      isMenu: true,
      needLogin: false,
    },
  },
  {
    path: "/login", //
    component: lazy(() => import("../pages/login")),
  },
  {
    path: "*", //404页面
    component: lazy(() => import("../pages/e404")),
  },
];

export default RouteTable;
